package cn.jaye.fabric.application;

import cn.jaye.fabric.application.command.user.LoginUserCommand;
import cn.jaye.fabric.application.command.user.RegisterUserCommand;
import cn.jaye.fabric.domain.repository.OrgRepository;
import cn.jaye.fabric.domain.service.ConfigService;
import cn.jaye.fabric.domain.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author Jaye
 * @create 2018-05-09 9:06
 */
@Service
public class UserApplicationService {


    @Autowired
    private OrgRepository orgRepository;

    @Autowired
    private ConfigService configService;

    @Autowired
    private UserService userService;


    public String register(RegisterUserCommand registerUserCommand) throws Exception {
        return userService.register(registerUserCommand.getUsername(), registerUserCommand.getOrgId());
    }

    public boolean login(LoginUserCommand loginUserCommand) throws Exception {
        return userService.login(loginUserCommand.getUsername(), loginUserCommand.getPassword(), loginUserCommand.getOrgId());
    }
}
